<?php
include $_SERVER['DOCUMENT_ROOT'].'/PariGest/pages/inc/enteteAjax.php';
require_once $REP_CLASS . 'class.Pari.php';
$pari = new Pari($db);
$result = "OK";
try
{
  $pari->setIdCompte($_POST["IdCompte"]);
  $pari->setIdOperation($_POST["IdOperation"]);
  $pari->affichage();
    
  // Pari gagné
  if( $_POST["Action"] == "G" )
  {
    $pari->setIndResultat(Pari::$IND_RESULTAT_GAGNE); 
  }
  // Pari perdu
  elseif( $_POST["Action"] == "P" )
  {
    $pari->setIndResultat(Pari::$IND_RESULTAT_PERDU);
  }
  // Pari annulé
  elseif( $_POST["Action"] == "A" )
  {
    $pari->setIndResultat(Pari::$IND_RESULTAT_ANNULE);
  }
  $pari->modification();
   
  $db->commit();
}
catch(MyException $e)
{
  $this->trace->fb('<== Erreur ==>');
  $result = "KO";
  include $_SERVER['DOCUMENT_ROOT'].'/PariGest/pages/inc/catchAjax.php';      
}
	
?>
<?php echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" ?>
<root>
<result><?php echo $result ?></result>
</root>